package cn.chenxiejia.demo.service.impl;

import cn.chenxiejia.demo.dao.TestMapper;
import cn.chenxiejia.demo.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private TestMapper testMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public String test() {
        log.info("测试方法");
        String test = testMapper.test();
        log.info("查询结果：{}",test);

        redisTemplate.opsForValue().set("test","testValue");

        Object value = redisTemplate.opsForValue().get("test");

        log.info("测试redis:{}",String.valueOf(value));

        return test;

    }
}
